﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Order_List_View.aspx.cs" MasterPageFile="~/MasterPage.master"
    Inherits="OrderManagement_Order_List_View" %>

 <%@ Register Src="../UserControl/GridPager.ascx" TagName="GridPager" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <title>订单查询</title>
        
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <script type="text/javascript">
    /*  
    将Date/String类型,解析为String类型.  
    传入String类型,则先解析为Date类型  
    不正确的Date,返回 ''  
    如果时间部分为0,则忽略,只返回日期部分.  
    */
    function formatDate(v) {
        if (v instanceof Date) {
            var y = v.getFullYear();
            var m = v.getMonth() + 1;
            var d = v.getDate();
            var h = v.getHours();
            var i = v.getMinutes();
            var s = v.getSeconds();
            var ms = v.getMilliseconds();
            if (ms > 0)
                return y + '/' + m + '/' + d + ' ' + h + ':' + i + ':' + s
						+ '.' + ms;
            if (h > 0 || i > 0 || s > 0)
                return y + '/' + m + '/' + d + ' ' + h + ':' + i + ':' + s;
            return y + '/' + m + '/' + d;
        }
        return '';
    }

    $(function () {
        $('#<%=txtStart.ClientID %>').datebox({
            currentText: '今天',
            closeText: '关闭',
            disabled: false,
            required: true,
            missingMessage: '必填',
            formatter: formatDate
        });
    });
    $(function () {
        $('#<%=txtEnd.ClientID %>').datebox({
            currentText: '今天',
            closeText: '关闭',
            disabled: false,
            required: true,
            missingMessage: '必填',
            formatter: formatDate
        });
    });
</script>
    <div>
        <table id="wsd_inputtable">
            <tr>
                <td class="tabletitle" colspan="6">
                    搜索选项
                </td>
            </tr>
            <tr>
                <td class="tablefield">
                    <span class="keyword">*</span>组织架构:
                </td>
                <td>
                    <asp:TextBox ID="txtOrg" runat="server" 
                class="default"           onkeydown="alert('请选择组织架构');return false;" ontextchanged="txtOrg_TextChanged"></asp:TextBox>
                    <img id="imgOrg" alt="查找" onclick="openPopup('../System/PopupOrganization.aspx?NameControlId=<%# txtOrg.UniqueID %>&ChainsControlID=<%# txtHidChains.UniqueID %>&ValueControlId=<%# txtHidOrg.UniqueID %>&UserListControlID=<%#txtHidUsers.UniqueID %>&SelectType=multi','','300','500');"
                        src="../Resources/Images/search.png" style="cursor: pointer;" /><br />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtOrg"
                        ErrorMessage="请选择组织架构" Display="Dynamic"></asp:RequiredFieldValidator>
                    </td>
                <td class="tablefield">
                    销售代表:
                </td>
                <td nowrap="nowrap">
                    <asp:DropDownList AutoPostBack=true OnSelectedIndexChanged="SelectPersons" runat="server" ID="ddlUser" Width="150">
                    </asp:DropDownList>
                </td>
                <td class="tablefield">
                    起始日期:
                </td>
                <td nowrap="nowrap">
                    <asp:TextBox runat="server" ID="txtStart"  class="default" Width="150"   ></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="tablefield">
                    订单类型:
                </td>
                <td nowrap="nowrap">
                    <asp:DropDownList runat="server" ID="ddlOrderType" Width="150">
                    </asp:DropDownList>
                </td>
                <td class="tablefield">
                    &nbsp;经销商:
                </td>
                <td nowrap="nowrap">
                    <asp:DropDownList ID="ddlChains" Width="150" runat="server">
                    </asp:DropDownList>
                </td>
                <td class="tablefield">
                    结束日期:
                </td>
                <td nowrap="nowrap">
                    <asp:TextBox runat="server" ID="txtEnd"   class="default" Width="150"  ></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="tablefield">
                    关键字:
                </td>
                <td nowrap="nowrap">
                    <asp:TextBox runat="server" ID="txtCode"  class="default"  ></asp:TextBox>
                </td>
                <td class="tablefield">
                    &nbsp;渠道类型:
                </td>
                <td nowrap="nowrap">
                    <asp:DropDownList runat="server" ID="ddlChannel" Width="150">
                    </asp:DropDownList>
                </td>
                <td class="tablefield">
                    订单状态:
                </td>
                <td nowrap="nowrap">
                    <asp:DropDownList runat="server" ID="ddlStatus" Width="150">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="tablefield">
                    订单编号:
                </td>
                <td nowrap="nowrap">
                    <asp:TextBox ID="txtOrderNo" runat="server"  class="default"  ></asp:TextBox>
                </td>
                <td class="tablefield">
                    订单来源:</td>
                <td>
                    <asp:DropDownList ID="ddlOrderForm" runat="server" Width="150">
                    </asp:DropDownList>
                </td>
                <td class="tablefield">
                    有效:
                </td>
                <td>
                    <asp:DropDownList ID="drpCancelled" runat="server" Width="150">
                        <asp:ListItem Value="">--所有--</asp:ListItem>
                        <asp:ListItem Value="N">有效</asp:ListItem>
                        <asp:ListItem Value="Y">无效</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="tablefield">
                    &nbsp;</td>
                <td nowrap="nowrap">
                    &nbsp;</td>
                <td class="tablefield">
                    &nbsp;</td>
                <td  colspan="3" class="tablefield">
                    <input id="txtHidOrg" type="hidden" runat="server" />
                    <input id="txtHidChains" type="hidden" runat="server" />
                    <input id="txtHidUsers" type="hidden" runat="server" />
                    <asp:Button ID="btnQuery" runat="server" class="wsd_button2" Text="查  询" OnClick="btnQuery_Click" />
                    &nbsp;
                    <input type="button" class="wsd_button2" size="47" value="重  置" name="reset" onclick="clearForm('form1')" /></td>
                
            </tr>
        </table>
        <br />
        <table id="wsd_inputtable">
            <tr>
                <td class="tabletitle">
                    订单列表
                   
            </tr>
        </table>
        <table id="wsd_listtable" width="100%">
            <tr>
                <td style="width: 100%">
                    <asp:GridView Width="100%" ID="gvChannelType" runat="server" AutoGenerateColumns="false"
                        EmptyDataText="没有可显示的数据." EmptyDataRowStyle-Font-Bold="true" EmptyDataRowStyle-HorizontalAlign="Center"
                        EnableEmptyContentRender="true" OnRowDataBound="Grid_RowDataBound" AllowPaging="True"
                        PageSize="10" OnPageIndexChanging="gvChannelType_PageIndexChanging" GridLines="None">
                        <HeaderStyle CssClass="titlist" />
                        <EmptyDataRowStyle HorizontalAlign="Center" Font-Bold="True"></EmptyDataRowStyle>
                        <Columns>
                            <asp:HyperLinkField DataNavigateUrlFormatString="Order_Maintain.aspx?orderID={0}&customerID={1}&READONLY"
                                DataNavigateUrlFields="ORDER_ID,CUSTOMER_ID" DataTextField="ORDER_NO" HeaderText="订单号码" ControlStyle-Font-Underline="false" />
                            <asp:TemplateField HeaderText="类型">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblOrderType" Text='<%# Jumpton.SFA.Server.Entity.ORDER_HEADERS.GetOrderType(Convert.ToInt32(Eval("OrderType"))) %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField HeaderText="门店名称" DataField="CUSTOMER_NAME" HeaderStyle-Width="60px"/>
                            <asp:BoundField HeaderText="金额" DataField="TOTAL_AMOUNT" />
                            <asp:BoundField HeaderText="经销商名称" DataField="DESCRIPTION" HeaderStyle-Width="70px"/>
                            <asp:BoundField HeaderText="销售代表" DataField="USER_NAME" HeaderStyle-Width="60px"/>
                           
                              <asp:TemplateField HeaderText="订单日期">
                                    <ItemTemplate>
                                        <asp:Label runat="server" ID="lblORDER_date" Text='<%# Jumpton.SFA.Server.BusinessRule.BusinessLogic.GetDateTime(Eval("ORDER_date").ToString(),"yyyyMMddHHmmss","yyyy-MM-dd")  %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            
                              <asp:TemplateField HeaderText="发货日期">
                                    <ItemTemplate>
                                        <asp:Label runat="server" ID="lblREQ_DELIVERY_date" Text='<%# Jumpton.SFA.Server.BusinessRule.BusinessLogic.GetDateTime(Eval("REQ_DELIVERY_date").ToString(),"yyyyMMddHHmmss","yyyy-MM-dd")  %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            <asp:TemplateField HeaderText="状态">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblStatusDescription" Text='<%# Jumpton.SFA.Server.Entity.ORDER_HEADERS.GetStatusDescription(Convert.ToInt32(Eval("STATUS"))) %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField HeaderText="来源" DataField="ORDER_FORM_NAME" />
                            <asp:BoundField HeaderText="有效" DataField="CANCELLED" HeaderStyle-Width="30px" />
                        </Columns>
                        <RowStyle CssClass="evenline" />
                        <AlternatingRowStyle CssClass="oddline" />
                        <PagerSettings FirstPageText="首页" LastPageText="尾页" Visible="false" Mode="NumericFirstLast" PageButtonCount="30" />
                    </asp:GridView>
                     <br />
                    <uc1:GridPager ID="GridPager1" runat="server" />
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
